package com.huawei.zyb.taskManager.domain.project.valueobject;

import java.util.Objects;

/**
 * 项目唯一标识值对象
 */
public final class ProjectId {
    private final Long value;

    private ProjectId(Long value) {
        if (value == null) {
            throw new IllegalArgumentException("项目ID不能为空");
        }
        if (value <= 0) {
            throw new IllegalArgumentException("项目ID必须为正数");
        }
        this.value = value;
    }

    public static ProjectId of(Long value) {
        return new ProjectId(value);
    }

    public Long getValue() {
        return value;
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj) return true;
        if (obj == null || getClass() != obj.getClass()) return false;
        ProjectId projectId = (ProjectId) obj;
        return Objects.equals(value, projectId.value);
    }

    @Override
    public int hashCode() {
        return Objects.hash(value);
    }

    @Override
    public String toString() {
        return "ProjectId{" + value + "}";
    }
}